/* eslint-disable no-async-promise-executor */
const model = require("../models/model")
const ShopAdderess = model.shopAddress.ShopAdderess

exports.details = async(ctx) => {
  const { addressId } = ctx.request.body
  if (!addressId) {
    ctx.fail('参数错误')
    return
  }
  const res = await ShopAdderess.findOne({ where: { id: addressId }})
  if (res) {
    for (let prop in res) {
      if (prop == 'isDefault') {
        delete res[prop]
      }
    }
    ctx.success(res)
  } else {
    ctx.fail()
  }
}